﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PagedList<kysec.RAL.EFToMySql.tb_news>>" %>
<%@ Import Namespace="kysec.RAL.EFToMySql" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc"%>
<%@ Import Namespace="System.Xml" %>
<%string type = Request.QueryString["type"].ToString(); if (Model.Count == 0)
   {%>
    <span style="text-align:center; color:Red; font-size:16px;">没有任何信息，请添加信息……</span><a href="<%=kysec.CR.MyUrl.WebData.WEBURL %>/News/AddNews?type=<%:type %>" style="color:Green; margin-left:20px;">新增新闻</a>
<%}else{ %>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" onmouseover="changeto()"  onmouseout="changeback()">
  <tr>
    <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">标题</span></div></td>
    <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">内容</span></div></td>
    <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">图片</span></div></td>
    <td width="5%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10" title="点击类型转换">类型</span></div></td>
    <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">来源</span></div></td>
    <td width="12%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">发布时间</span></div></td>
    <td width="5%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">点击量</span></div></td>
    <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">当前状态</span></div></td>
<%--    <td width="8%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10" title="点击设置为热点新闻">热点新闻</span></div></td>--%>
    <td width="20%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">操作</span></div></td>
  </tr>
    <% foreach (kysec.RAL.EFToMySql.tb_news item in Model)
       {
           XElement imgPath = XElement.Parse(item.c_x_imgPath);
           //XElement imgPath = new XElement(item.c_x_imgPath);
           %>
  <tr>
    <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19"><%= Html.Encode(item.c_vc_title) %></span><input type="hidden" id="newId" value="<%:kysec.CR.Common.EncodeByBase64.Encode((item.c_uq_newId).ToString()) %>" /></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><span class="STYLE19" title="<%=Html.Encode(item.c_ntx_content) %>">新闻显示</span></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><span class="STYLE19" title="<%if (imgPath.HasElements) {  %><%=imgPath.Element("item").Attribute("url").ToString() %><%}else{ %>此新闻没有图片<%} %>">图片路径</span></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%string popStr = int.Parse(Html.Encode(item.c_i_classify).ToString()) == 1 ? "公司新闻" : "行业新闻" ; %><a title="点击转换新闻类型" href="<%:kysec.CR.MyUrl.WebData.WEBURL %>/News/SetType?newId=<%:item.c_uq_newId %>&type=<%:item.c_i_classify %>"><%=popStr %></a></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><span class="STYLE19"><%= Html.Encode(item.c_nvc_from) %></span></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"> <%= Html.Encode(item.c_dt_publishDate.ToShortDateString()) %></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=int.Parse(Html.Encode(item.c_i_hot).ToString())%></div></td>
    <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%if (bool.Parse(Html.Encode(item.c_b_isDelete).ToString())){%> 已删除<%} else{%>未删除<%} %></div></td>
    <%--<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><a href="<%:kysec.CR.MyUrl.WebData.WEBURL %>/News/SetHot?newId=<%:item.c_uq_newId %>&type=<%:item.c_i_classify %>" title="点击设置为热点新闻"><%string hotStr = int.Parse(Html.Encode(item.c_i_hot).ToString()) == 1 ? "热点新闻" : "普通新闻"; %><%:hotStr %></a></div></td>--%>
    <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE21"><%if(!item.c_b_isDelete){ %><span class="del"><a href="<%:kysec.CR.MyUrl.WebData.WEBURL %>/News/UpdateNews?id=<%=kysec.CR.Common.EncodeByBase64.Encode((item.c_uq_newId).ToString())  %>&type=<%:item.c_i_classify %>&isUpdate=true" target="main">修改</a> &nbsp;|&nbsp;<a href="<%=kysec.CR.MyUrl.WebData.WEBURL  %>/News/UpdateNews?id=<%=kysec.CR.Common.EncodeByBase64.Encode((item.c_uq_newId).ToString())  %>&type=<%=item.c_i_classify %>&isUpdate=false" target="main">查看</a>&nbsp;|&nbsp;<a href="<%=kysec.CR.MyUrl.WebData.WEBURL %>/News/Delete?id=<%=kysec.CR.Common.EncodeByBase64.Encode((item.c_uq_newId).ToString())%>&type=<%:item.c_i_classify %>">删除</a></span><%}else{ %><span class="restore"><a href="<%=kysec.CR.MyUrl.WebData.WEBURL %>/News/Delete?id=<%=kysec.CR.Common.EncodeByBase64.Encode((item.c_uq_newId).ToString())%>&type=<%:item.c_i_classify %>">恢复</a></span><%} %></div></td>
  </tr> 
  <%} %>
</table><%} %>
<%=Html.AjaxPager(Model, new PagerOptions() { CssClass = "mvcPager", PageIndexParameterName = "id", ShowMorePagerItems = false, AlwaysShowFirstLastPageNumber = true, ShowPageIndexBox = true, PageIndexBoxWrapperFormatString = "页{0}" }, new AjaxOptions() { UpdateTargetId = "page" })%>
